﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AlarmClock
{
    public partial class TipLabel : Label
    {
        private String text;
        private bool isLongtext;

        public TipLabel()
        {
            InitializeComponent();
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
        }

        public void setText(String text)
        {
            this.text=text;
            if (text.Length > 4)
            {
                isLongtext = true;
                this.Text = text.Substring(0, 4);
            }
            else
            {
                this.Text = text;
                isLongtext = false;
            }
        }
        public String getText()
        {
            return text;
        }

        public void label_MouseHover(object sender, EventArgs e)
        {
            if (isLongtext)
            {
                ttShowText.ShowAlways = true;
                ttShowText.SetToolTip(this, text);
            }
        }
    }
}
